package com.leetcode.bit;

/**
 * @author Dennis Li
 * @date 2020/7/21 15:37
 */
public class IsPowerOfFour_342 {

    public boolean isPowerOfFour(int num) {
        // 超过1个位数，那么为假
        return num > 0 && Integer.bitCount(num) == 1 && Double.compare(Math.sqrt(num), (int) Math.sqrt(num)) == 1;
    }

}
